<?php

class Model {
    
    protected function getByKey($tableName, $columnName, $columnValue, $isText = false){
        $db = DB::getInstance();
        $StQuery = 'SELECT * FROM "'. $tableName .'" WHERE "'. $columnName .'" = ';
        $StQuery .= !$isText ? $columnValue : "'{$columnValue}'";
        $db->execute($StQuery);
        $Result = $db->fetchAll();
        $db->close();
        return isset($Result[0]) ? $Result[0] : null;
    }
    
}

?>
